package com.hxzy.tms.teamTest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import junit.framework.TestCase;

public class Abstract extends TestCase {
	protected Logger logger = LoggerFactory.getLogger(getClass());
	private ApplicationContext applicationContext;
	
	protected ApplicationContext getApplicationContext(){
		if (applicationContext == null) {
			applicationContext = new ClassPathXmlApplicationContext(getConfigFile());
		}
		return applicationContext;
	}
	
	protected String[] getConfigFile(){
		
		return new String[] {"applicationContext-dao.xml","applicationContext-service.xml","applicationContext-tx.xml"};
	}
	
	protected Object getBean(String name){
		return getApplicationContext().getBean(name);
	}
	
}
